function e = convertRotationMatrix2UnitQuaternion(R)

    e0 = 0.5 * sqrt( 1 + R(1,1) + R(2,2) + R(3,3) );
    e1 = ( R(3,2) - R(2,3) ) / ( 4*e0 );
    e2 = ( R(1,3) - R(3,1) ) / ( 4*e0 );
    e3 = ( R(2,1) - R(1,2) ) / ( 4*e0 );
    
    e = [ e0 e1 e2 e3 ]';